<%@ page import="com.wuchao.service.serviceImpl.ServiceImpl" %>
<%@ page import="com.wuchao.entity.User" %>
<%@ page import="java.util.List" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
h1,span{
    color: red;
    font-size: 33px;
}
    </style>
</head>
<body>
<h1>欢迎来到主页面</h1>
<table border="4">
    <tr>
        <th>id</th>
        <th>name</th>
        <th>sex</th>
        <th>hobby</th>
        <th>操作</th>
    </tr>
    <% ServiceImpl service = new ServiceImpl();
        List<User> list = service.findPoJo("select * from user");
        for(User xjj : list){%>
    <tr>
        <td><%=xjj.getId()%></td>
        <td><%=xjj.getName()%></td>
        <td><%=xjj.getSex()==1?"男":"女"%></td>
        <td><%=xjj.getHobby()%></td>
      <%--  Op标志删除带上id--%>
        <td><a href="controller.jsp?id=<%=xjj.getId()%>&op=delete">
            <input type="button" id="bt" value="删除"></a>
            <a href="controller.jsp?id=<%=xjj.getId()%>&op=update1"><input type="button" id="update" value="修改"></a></td>
    </tr>
    <%}
    %>

</table>
<a href="add.jsp"><input type="button" id="add" value="增加"></a>
<span> <%=request.getParameter("feifa")==null?"":"非法入侵"%></span>
<span> <%=request.getParameter("isdelete1")==null?"":"删除成功"%></span>
<span> <%=request.getParameter("isdelete2")==null?"":"删除失败"%></span>
<span> <%=request.getParameter("isadd1")==null?"":"增加成功"%></span>
<span> <%=request.getParameter("isadd2")==null?"":"增加失败"%></span>
<span> <%=request.getParameter("isupdate1")==null?"":"修改成功"%></span>
<span> <%=request.getParameter("isupdate2")==null?"":"修改失败"%></span>
<script src="../js/jquery.js"></script>
<script>
$("tr:odd").css("background-color","yellow");
$("#bt").click(function () {
    if(confirm("删不删？")){
        return true;
    }else {
        return false;
    }
});
</script>
</body>
</html>
